
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		<Agurto, Jorge>
-- Create date: <23/10/2011>
-- Description:	<El Select del insert es un query Dinamico de Unions>
-- =============================================
CREATE PROCEDURE [GOOGLECODERS].RolFuncionalidadesIns
	@QueryUnions varchar(2000) = ''
AS
BEGIN
	DECLARE @TableAux TABLE ( 
	IdRol INT NOT NULL, 
	IdFuncionalidad INT NOT NULL)

	INSERT INTO @TableAux (IdRol, IdFuncionalidad) 
	EXEC(@QueryUnions)

	INSERT INTO [GOOGLECODERS].[Funcionalidad_x_Rol]
	SELECT IdFuncionalidad, IdRol FROM @TableAux
END
GO